<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/common/taglibs.jsp"%>
<!DOCTYPE html>
<html>
<head>
<base target="_self" />
<%@ include file="/common/meta.jsp"%>
<%@ include file="/common/jqGridHead.jsp"%>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Banner管理--${fns:getConfig('productName')}</title>
</head>
<body>
<ul class="nav nav-tabs" style="margin:0 4px;margin-bottom:4px;">
		<li class="active">
			<a href="${ctx}/banner/show.do?top=${fns:encodeParam(top)}&left=${fns:encodeParam(left)}">
				<i class="icon icon-edit"></i>&nbsp;Banner列表
			</a>
		</li>
		<sec:authorize ifAnyGranted="ROLE_sys_banner_edit">
		<li >
			<a href="${ctx}/banner/input.do?top=${fns:encodeParam(top)}&left=${fns:encodeParam(left)}"> 
				<i class="icon icon-list"></i>&nbsp;新增
			</a>
		</li>
		</sec:authorize>
	</ul>
	<form id="mainForm"  role="form" method="get">
		<div class="breadcrumb form-search" style="background-color: #f5f5f5;">
			<div>
				<label>关键字:</label>
				<input type="text"  name="filter_LIKES_name_OR_uploadPerson_OR_remark" placeholder="名称或相关关键字"  value="${name}"/>
					<button id="btnSearch" name="btnSearch" type="submit" class="btn btn-primary" onclick="queryForGrid('mainForm','jqGrid');return false">查询</button>
			</div>
		</div>
	
	<tags:message content="${msg}"/>
	<table id="jqGrid"></table>
	<div id="jqGridPager"></div>
	</form>

	<script type="text/javascript">
		$(document).ready(function()
		{
			var jqgridH = $(window).height()-350;
			$("#jqGrid").jqGrid(
			{ url : '${ctx}/banner/list.do',
			  mtype : "GET",
			  datatype : "json",
			  page : 1,
			  viewrecords: true,
			  colModel :
			[ <sec:authorize ifAnyGranted="ROLE_sys_banner_edit" >
					{ label : "操作", name : "id", 
					  width : 120,   align : 'center', sortable : false, search : false ,
					  classes:'ui-jqgrid-optClass',
					  formatter: function (cellValue, options, rowObject){
	                    	return "<a href='${ctx}/banner/input.do?id=" + cellValue + "&top=${fns:encodeParam(top)}&left=${fns:encodeParam(left)}' class='underline'><i class='glyphicon glyphicon-edit'></i>修改</a>"+
	                        "<a href='${ctx}/banner/delete.do?id="+ cellValue +"&top=${fns:encodeParam(top)}&left=${fns:encodeParam(left)}' onclick='return confirm(\"确认要删除该记录吗？\", this.href)' ><i class='icon icon-remove'></i>删除</a>";
	                    	
					  }
	                    },
	                    </sec:authorize>
					{ label : '名称', name : 'name', align : 'center', width : 150},
					{ label : '链接', name : 'path', align : 'center', width : 450},
					{ label : '排序', name : 'sort', align : 'center', width : 120},
					{ label : '上传人', name : 'uploadPerson', align : 'center', width : 100 }
// 					{ label : '备注', name : 'remark', align : 'center', width : 100}
			], autowidth : false,width:$(window).width()-245, height : jqgridH,scrollOffset:0, shrinkToFit : 400, rowNum : 10, viewrecords : true, rownumbers : true,
			jsonReader:{
    			root: "result",
    			page: "currentPage",
    			total: "totalPages",
    			records: "totalCount",
    			repeatitems: true,
    			cell: "cell",
    			id: "id",
    			userdata: "userdata",
    			subgrid: {root:"results", repeatitems: true, cell:"cell"}
    		},
    		prmNames: {
				page:"pageNo",
				rows:"pageSize",
				sort: "orderBy",
				order: "order",
				search:"_search",
				nd:"nd", id:"id",
				oper:"oper",
				editoper:"edit",
				addoper:"add",
				deloper:"del",
				subgridid:"id",
				npage: null,
				totalrows:"totalCounts"
			}, 
			rowList :[10,20,30], 
			pager : "#jqGridPager"
			});
			
			 $('#jqGrid').navGrid("#jqGridPager", {                
	                search: false, // show search button on the toolbar
	                searchtext:'搜索',
	                add: false,
	                edit: false,
	                del: false,
	                refresh: false,
	                refreshtext:'刷新'
	            },
	            {}, // edit options
	            {}, // add options
	            {}, // delete options
	            { multipleSearch: true,multipleGroup: true} // search options - define multiple search
	            );

			$("#jqGrid").jqGrid('setGroupHeaders',
			{ useColSpanStyle : true, // 没有表头的列是否与表头列位置的空单元格合并
				});
			
			$("#searchmodfbox_jqGrid").css("width", "660px");
		});
	</script>
</body>
</html>
